﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using DLV.Library.Utilities;

namespace DLV.Data.Entities
{
    public class PriceItemInfo
    {

        #region private fields

        private int _priceItemId = Null.NullInteger;
        private string _priceItemName = Null.NullString;
        private int _scheduleId = Null.NullInteger;
        private int _priceId = Null.NullInteger;
        private int _quantity = Null.NullInteger;
        private decimal _totalPrice = Null.NullDecimal;
        private int _priceItemType = Null.NullInteger;
        private int _createdBy = Null.NullInteger;
        private DateTime _createdDate = Null.NullDate;
        private int _updatedBy = Null.NullInteger;
        private DateTime _updatedDate = Null.NullDate;
        private int _status = Null.NullInteger;
        private DateTime _goDate = Null.NullDate;

        #endregion

        #region public properties

        public int PriceItemId
        {
            get { return _priceItemId; }
            set { _priceItemId = value; }
        }
        public string PriceItemName
        {
            get { return _priceItemName; }
            set { _priceItemName = value; }
        }
        public int ScheduleId
        {
            get { return _scheduleId; }
            set { _scheduleId = value; }
        }
        public int PriceId
        {
            get { return _priceId; }
            set { _priceId = value; }
        }
        public int Quantity
        {
            get { return _quantity; }
            set { _quantity = value; }
        }
        public decimal TotalPrice
        {
            get { return _totalPrice; }
            set { _totalPrice = value; }
        }
        public int PriceItemType
        {
            get { return _priceItemType; }
            set { _priceItemType = value; }
        }
        public int CreatedBy
        {
            get { return _createdBy; }
            set { _createdBy = value; }
        }
        public DateTime CreatedDate
        {
            get { return _createdDate; }
            set { _createdDate = value; }
        }
        public int UpdatedBy
        {
            get { return _updatedBy; }
            set { _updatedBy = value; }
        }
        public DateTime UpdatedDate
        {
            get { return _updatedDate; }
            set { _updatedDate = value; }
        }
        public int Status
        {
            get { return _status; }
            set { _status = value; }
        }
        public DateTime GoDate
        {
            get { return _goDate; }
            set { _goDate = value; }
        }
        #endregion

        #region Custom

        public string PartnerName { get; set; }
        public string TypeName { get; set; }
        public string AgeName { get; set; }
        public string Time { get; set; }
        public decimal SalePrice { get; set; }
        public string DateName { get; set; }
        public string BeginLocationName { get; set; }
        public string EndLocationName { get; set; }
        public string ScheduleName {
            get { return BeginLocationName + " -> " + EndLocationName; }
        }

        public string ConcernSortName { get; set; }
        public string Name { get; set; }
        public int AgeId { get; set; }
        public int RegisterYear { get; set; }
        public string MenuTypeName { get; set; }

        public string ItemName
        {
            get
            {
                var itemName = PartnerName;
                if (!String.IsNullOrEmpty(TypeName))
                    itemName += " - " + TypeName;
                if (!String.IsNullOrEmpty(MenuTypeName))
                    itemName += " - " + MenuTypeName;
                if (!String.IsNullOrEmpty(AgeName) && PriceItemType != (int)Globals.PriceType.TicketCar)
                    itemName += " - " + AgeName;
                if (!String.IsNullOrEmpty(Time))
                    itemName += PriceItemType == (int)Globals.PriceType.TicketCar 
                        ? " - " + Time +  " chỗ"
                        : " - Đi lúc " + Time;
                itemName += " - " + SalePrice.ToString("#,###", new CultureInfo("vi-VN")) + " VND";
                return itemName;
            }
        }

        public string TicketStationName
        {
            get
            {
                var ticketStationName = TypeName + " - " + SalePrice.ToString("#,###", new CultureInfo("vi-VN")) + " VND";
                return ticketStationName;
            }
        }

        
        #endregion
    }
}
